const app = require('./app')
const request = require('./utils/request.js')
// 导入配置
var config = require('./config/config')

// 创建HTTP服务与HTTPS服务
request.createServer(app, '3000', 'HTTP')
// request.createServer(app, '3001', 'HTTPS', config.sslAddr)

// 在生产环境,创建反向代理,用于绑定域名
/*
if (process.env.NODE_ENV == 'production') {
  // 创建HTTP代理
  request.createProxy([
    { host: 'cmplaning.cn', target: 'http://localhost:3000' },
    { host: 'www.cmplaning.cn', target: 'http://localhost:3000/user' }
  ], '80', 'HTTP')
  // 创建HTTPS代理
  request.createProxy([
    { host: 'cmplaning.cn', target: 'https://localhost:3001' }
  ], '443', 'HTTPS', config.sslAddr)
}
*/
